<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Multiple Select Option</title>
</head>
<body>
<h4>Select the color/s you like from the drop down list</h4>
<form>
<select name="color" multiple size="6">
<option>Pink</option>
<option>Orange</option>
<option>Yellow</option>
<option>Blue</option>
<option>Black</option>
<option>Brown</option>
<option>Gray</option>
</select>
<p><input type="submit" value="submit"></p>
</form>

<% 
String clrs[] = request.getParameterValues("color");
if(clrs != null)
{
%>
<p><b>You have selected the following colors</b></p>
<ul>
<%
for(int i=0; i<clrs.length; i++)
{
%>
<li><%=clrs[i]%></li>
<%
}
%>
</ul>
<%
}
%>
</body>
</html>